class EventBus {
  callbacks = {};
  $on(event, cb) {
    if (this.callbacks[event]) {
      this.callbacks[event].push(cb);
    } else {
      this.callbacks[event] = [cb];
    }
  }
  $emit(event, ...cb) {
    this.callbacks[event].forEach((item) => item(...cb));
  }
}

const bus = new EventBus();
export default bus;
